import xlrd
from xlutils.copy import copy
wb=xlrd.open_workbook('成绩单.xls')
ws=wb.sheet_by_name('一班')
nwb=copy(wb)
nws=nwb.get_sheet('一班')
nws.write(0,3,'等级')
n=0
while n<ws.nrows-1:
    n+=1
    subtotal=ws.cell_value(n,1)+ws.cell_value(n,2)
    if subtotal>180:
        nws.write(n,3,'优秀')
    elif subtotal>160:
        nws.write(n,3,'良好')
    elif subtotal>120:
        nws.write(n,3,'一般')
    else:
        nws.write(n,3,'较差')
nwb.save('成绩单等级.xls')
